#include<iostream>
using namespace std;
class ListNode {
public:
	int data;
	ListNode* next;
	ListNode() {
		next = NULL;
	}
};
class List {
public:
	ListNode* head;
	int len;
	List() {
		head = new ListNode;
		len = 0;
	}
	void push(int n) {
		ListNode* p = new ListNode;
		p->data = n;
		ListNode* q = head;
		while (q->next != NULL) {
			q = q->next;
		}
		q->next = p;
		len++;
	}
	~List() {
		ListNode* p = head;
		while (p != NULL) {
			head = head->next;
			delete p;
			p = head;
		}
		len = 0;
	}
	void del() {
		ListNode* p = head->next;
		while (p != NULL) {
			ListNode* ptr = p;
			ListNode* tmp = ptr->next;
			while (tmp != NULL) {
				if (p->data == tmp->data) {
					ptr->next = tmp->next;
					len--;
					tmp = ptr->next;
					continue;
				}
				ptr = ptr->next;
				tmp = ptr->next;
			}
			p = p->next;
		}
	}
	void print() {
		ListNode* p = head->next;
		cout << len << ':';
		while (p != NULL) {
			cout << ' ' << p->data;
			p = p->next;
		}
		cout << endl;
	}
};
int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int m;
		cin >> m;
		List L;
		int k;
		for (int j = 0; j < m; j++) {
			cin >> k;
			L.push(k);
		}
		L.del();
		L.print();
	}
	return 0;
}	